'''
商户相关事件列表查询
'''
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage


class BusinessCase(KeyWords):
    # 新增商户页面
    # url = KeyWords.url + 'business/events'

    # 新增商户相关联的事件
    def business_case(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\business\create_case.yaml')
        element_operation(self, data[0]['data'])

    # 商户事件列表
    def business_case_list(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\business\business_case.yaml')
        element_operation(self, data[0]['data'])

    # 商户事件列表排序
    def business_case_search_sort(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\business\business_case_sort.yaml')
        element_operation(self, data[0]['data'])

    # 查看当前列表是否全是商户相关的事件
    def business_case_check(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\business\business_case_check.yaml')
        element_operation(self, data[0]['data'])

    # 查看商户详情
    def business_search_and_detail(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\business\business_search_and_detail.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = BusinessCase(driver)
        case.business_case()
        driver.quit()
    except Exception as E:
        driver.quit()
